//
//  EtatConsultationController.h
//  Cabinet
//
//  Created by Florent Montsegur on 27/05/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "Consultation.h"
#import "ConsultationViewController.h"

@interface EtatConsultationController : NSWindowController<NSTableViewDataSource> {
@private
    NSManagedObjectContext *mManagedObjectContext;
    NSEntityDescription *mConsultationEntity;
    
    NSDatePicker *__unsafe_unretained mStartDate;
    NSDatePicker *__unsafe_unretained mEndDate;
    NSTableView *__unsafe_unretained mConsultationView;
    
    NSComboBox *__unsafe_unretained mPaiment;
    
    NSButtonCell *__unsafe_unretained mPayeeToutes;
    NSButtonCell *__unsafe_unretained mPayees;
    NSButtonCell *__unsafe_unretained mImpayees;   
    
    NSArray* mConsultations;
    
    NSTextField *__unsafe_unretained mMessage;
    NSTextField *__unsafe_unretained mTotal;
    
    ConsultationViewController *mConsultationWnd;
    
}

@property (nonatomic, strong) NSManagedObjectContext * mManagedObjectContext;
@property (nonatomic, strong) NSEntityDescription * mConsultationEntity;

@property (unsafe_unretained) IBOutlet NSDatePicker *mStartDate;
@property (unsafe_unretained) IBOutlet NSDatePicker *mEndDate;
@property (unsafe_unretained) IBOutlet NSComboBox *mPaiment;
@property (unsafe_unretained) IBOutlet NSTableView *mConsultationView;
@property (unsafe_unretained) IBOutlet NSTextField *mMessage;
@property (unsafe_unretained) IBOutlet NSTextField *mTotal;

@property (unsafe_unretained) IBOutlet NSButtonCell *mPayeeToutes;
@property (unsafe_unretained) IBOutlet NSButtonCell *mPayees;
@property (unsafe_unretained) IBOutlet NSButtonCell *mImpayees;

- (IBAction)rechercherAction:sender;
- (IBAction)consultationDoubleClickAction:(id)sender;
- (IBAction)modifierAction:sender;
- (IBAction)supprimerAction:sender;

// NSTableViewDataSource
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex;

- (NSInteger) count;
- (void) rechercher;
- (NSString*)getFeuille:(NSNumber*)value;

- (NSPredicate*) getPredicate;

- (Consultation*)getConsultationAtIndex:(NSInteger)aRowIndex;

@end
